<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh-cmn-Hans">
<!--<![endif]-->

<head>
    <meta charset="utf-8"/>
    <title>报名信息管理</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <link href="${ctx}/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="${ctx}/assets/global/css/components-rounded.min.css" rel="stylesheet" id="style_components" type="text/css" />
    <link href="${ctx}/assets/pages/css/login-5.min.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        body {
            font-family:    "Microsoft YaHei";
        }
        .user-login-5 .login-container > .login-content > .login-form .form-control {
            padding: 5px 0;
        }
    </style>
</head>

<body class=" login">
<div class="user-login-5">
    <div class="row bs-reset">
        <div class="col-md-6 bs-reset">
            <div class="login-bg" style="background-image:url(${ctx}/assets/pages/img/login/bg01.png)">
                <!-- <img class="login-logo" src="${ctx}/assets/pages/img/login/logo.png"/> -->
            </div>
        </div>
        <div class="col-md-6 login-container bs-reset">
            <div class="login-content">
                <h1 class="font-blue">报名信息管理</h1>
                <form action="${ctx}/back/login" class="login-form" method="post">
                    <div class="alert alert-danger display-hide">
                        <button class="close" data-close="alert"></button>
                        <div id="server_message"></div>
                    </div>
                    <div class="row">
                        <div class="col-xs-6">
                            <input class="form-control form-control-solid placeholder-no-fix form-group" type="text"
                                   autocomplete="off" placeholder="登录账号" name="loginName"/>
                        </div>
                        <div class="col-xs-6">
                            <input class="form-control form-control-solid placeholder-no-fix form-group" type="password"
                                   autocomplete="off" placeholder="密码" name="password"/>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="rem-password">
                                <label class="rememberme mt-checkbox mt-checkbox-outline">
                                    <input type="checkbox" name="remember" value="true"/> 记住账号
                                    <span></span>
                                </label>
                            </div>
                        </div>
                        <div class="col-sm-8 text-right">
                            <button class="btn red" type="submit" style="font-weight: 300;"><i class="fa fa-sign-in"></i> 进入</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="login-footer">
                <div class="row bs-reset">
                    <div class="col-xs-12 bs-reset">
                        <div class="login-copyright text-right">
                            <p>&copy; TJ.NEXT 2017</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--[if lt IE 9]>
<script src="${ctx}/assets/global/plugins/respond.min.js"></script>
<![endif]-->
<script src="${ctx}/assets/layouts/js/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/jquery-cookie/jquery.cookie.min.js"></script>
<script src="${ctx}/assets/layouts/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/jquery-validation/js/additional-methods.min.js" type="text/javascript"></script>
<%--<script src="${ctx}/assets/global/plugins/backstretch/jquery.backstretch.min.js" type="text/javascript"></script><!-- 背景轮播 -->--%>
<%--<script src="${ctx}/assets/global/scripts/app.min.js" type="text/javascript"></script>--%>
<%--<script src="${ctx}/assets/pages/scripts/_login-5.js" type="text/javascript"></script>--%>

<script type="text/javascript">
    $(function() {
        jumpLogin();
        setLoginName();
        showErrorMessage();

        $("[name='loginName']").focus();

        $("[name='loginName'], [name='password']").keydown(function(e) {
            if (e.keyCode == 13) {
                $("form").submit();
            }
        });
    });

    // 防止局部加载
    function jumpLogin() {
        var href = document.location.href;
        if ( ! /.*\/login$/.test(href)) {
            document.location.href = "${ctx}/login";
        }
    }

    // 登录失败后
    function showErrorMessage() {
        var errorMessage = "${loginModel.errorMessage}";
        if (errorMessage != "") {
            $(".alert-danger").removeClass("display-hide");
            $("#server_message").text(errorMessage);
            $("[name='loginName']").val("${loginModel.loginName}");
        }
    }

    // 记住账号
    function setLoginName() {
        var loginName = $.cookie("loginName");
        if (loginName != null) {
            $("[name='loginName']").val(loginName);
            $("[name='remember']").prop("checked", true);
        }
    }
</script>

</body>
</html>
